<?php

namespace App\Models;

use App\Models\User;
use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{
    protected $fillable = ['user_id','post_id','content','parent_id'];

    public function user() {
        return $this->belongsTo(User::class);
    }

    public function topic() {
        return $this->belongsTo(Post::class,'post_id','id');
    }

    public function comments() {
        return $this->belongsTo(Post::class,'id','post_id');
    }
}
